package day11.handler.simpleChannelHandler.response;

import day11.packet.response.ListGroupMembersResponsePacket;
import day11.util.session.GroupSession;
import day11.util.session.Session;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

import java.util.ArrayList;
import java.util.List;

/**
 * @author chenshijie
 * @date 2024/1/2 16:01
 */

public class ListGroupMembersResponseHandler extends SimpleChannelInboundHandler<ListGroupMembersResponsePacket> {
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, ListGroupMembersResponsePacket listGroupMembersResponsePacket) throws Exception {
        if (listGroupMembersResponsePacket.isSuccess()) {

            System.out.println("群号【" + listGroupMembersResponsePacket.getGroupId() + "】有以下群员: " +
                    listGroupMembersResponsePacket.getUserNameList());
        } else {
            System.err.println("获取失败，请稍后再试试！");
        }
    }
}
